// src/router/index.js
import {createRouter, createWebHashHistory} from 'vue-router';
import Login from '../views/login/index.vue';
import adminRoutes from './admin.js'
const routes = [
    {
        path: '/',
        name: '/',
        redirect: '/project/index',
    },
    {
        path: '/login',
        name: 'login',
        meta:{title:'登录'},
        component: Login,
    },

];

const router = createRouter({
    history: createWebHashHistory(),
    routes: routes.concat(adminRoutes)
});
router.beforeEach((to, from, next) => {
    document.title = to.meta.title || '默认标题'; // 使用路由元信息中的title，如果没有则使用默认标题
    document.getElementsByClassName('.header').innerHTML =  to.meta.title;
    next();
});
export default router;
